package com.kaifamiao.converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;

import java.util.logging.Logger;

public class BooleanConverter implements Converter<String, Boolean> {

    @Autowired
    private Logger logger;

    @Override
    public Boolean convert(String source) {
        logger.info( "将 " + source + " 转换为 Boolean" );
        return "Y".equalsIgnoreCase( source );
    }

}
